<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script type="text/javascript" src="scripts/jquery/jquery-1.7.1.js"></script>
	<link href="style/authority/basic_layout.css" rel="stylesheet" type="text/css">
	<link href="style/authority/common_style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="scripts/authority/commonAll.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<script language="javascript" type="text/javascript" src="scripts/My97DatePicker/WdatePicker.js"></script>
	<link rel="stylesheet" type="text/css" href="style/authority/jquery.fancybox-1.3.4.css" media="screen"></link>
	<script type="text/javascript" src="scripts/artDialog/artDialog.js?skin=default"></script>
    
    <title>订单查询</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<script type="text/javascript" src="scripts/Myscripts/alpha_add.js"></script>
  </head>
  
  <body>  
   <div id = "add_alpha_id">
    <div align="center">
  		<form name="form1" method="post">
  				<div id="container">	
		<div class="ui_content">
				<div class="ui_text_indent">
					<div id="box_border">
						<div id="box_top">查询</div>
						<div id="box_center" >
						订单日期：
						<input id="order_date" name="order_date" class="Wdate" value="2010-01-01" type="text" onFocus="WdatePicker()"/>
						           用户名：<input class="ui_input_txt2" type="text" id="u_name" name="u_name"/>
							订单类型：<input class="ui_input_txt2" type="text" id="order_type" name="order_type"/>
							
						</div>
						<div id="box_bottom">
							<button class="ui_input_btn1" onclick="document.form1.action='servlet/Orderqueryservlet?type=query';document.form1.submit();">查询</button>
						</div>
					</div>
				</div>
			</div>		
			<div class="ui_content">
				<div class="ui_tb">
				<table class="table" width="100%" id="orders">
  				<tr>
  					<th align="center">客户姓名</th>
  					<th align="center">电话</th>
  					<th align="center"><label>订单号</label></th>
  					<th align="center"><label>商品名称</label></th>
  					<th align="center"><label>商品数量</label></th>
  					<th align="center"><label>订单状态</label></th>
  					<th align="center"><label>操作</label>
  				</tr>
  				<c:forEach items="${orders}" var="temp">
  				<tr>
					<td><label>${temp.user_nick}</label></td>
					<td><label>${temp.cellphone}</label></td>
					<td><label>${temp.order_id}</label></td>
					<td><label>${temp.product_name}</label></td>
					<td><label>${temp.product_number}</label></td>
					<td><label>${temp.order_state}</label></td>
					
					<td>
						<c:if test="${temp.order_type=='新订'&&temp.order_state=='已完成'}"><button class="ui_input_btn1" onclick="document.form1.action='servlet/Orderqueryservlet?type=return&order_id=${temp.order_id}';document.form1.submit();">退货</button></c:if>
						<c:if test="${temp.order_type=='新订'&&temp.order_state=='已完成'}"><button class="ui_input_btn1" onclick="document.form1.action='servlet/Orderqueryservlet?type=exchange&order_id=${temp.order_id}';document.form1.submit();">换货</button></c:if>
						<c:if test="${temp.order_type=='新订'&&(temp.order_state=='可分配'||temp.order_state=='缺货'||temp.order_state=='new')}"><button onclick="document.form1.action='servlet/Orderqueryservlet?type=cancel&order_id=${temp.order_id}';document.form1.submit();">退订</button></c:if>
					</td>
				</tr>  
				</c:forEach>				
  			</table>  
				</div>
			</div>
		</div>		
  		</div>	
  		</form>
  	</div> 
  	 <script type="text/javascript">
    	if(${can_return=="failed"})alert("该商品不可退换货！");
    </script>
  	<script type="text/javascript">
    var eitem = document.getElementById("add_alpha_id");
    window.onload = add_alpha(eitem);
    </script>  
  </body>
</html>
